from manim import *
from numpy import flip, insert

LV,QL,QH,JH='#75cfb8','#bbdfc8','#f0e5d8','#ffc478'

class p1(MovingCameraScene):
    def construct(self):
        # self.camera.frame.save_state()
        # self.add(NumberPlane())
        # self.camera.frame.rotate(13*DEGREES,about_point=[0.0, 0.0, 1.0])
        x=ValueTracker(-3)
        a,b=[-3,-3,0],[3,-3,0]
        p=Polygon(a,b,[x.get_value(),3,0]).add_updater(lambda m:m.become(
            Polygon(a,b,[x.get_value(),3,0]).set_fill(LV,1)
        ))
        ba=Brace(Line(a,b),DOWN)
        bh=Brace(p,LEFT)
        self.add(p,ba,bh,
            MathTex('a').next_to(ba,DOWN),
            MathTex('h').next_to(bh,LEFT)
        )
        self.play(x.animate.set_value(6))
        self.wait()
        self.play(x.animate.set_value(-3))
        self.wait()

